let obj = {
    name: '康少',
    age: 18,
    like: {
        a: '唱',
        b: '跳',
        c: 'rap',
    },
    a: undefined,
    b: null,
    e: {},
}
function deepCopy(obj){
    let newObj=Array.isArray(obj)?[]:{}
    for(const key in obj){
        if(obj.hasOwnProperty(key)){//判断属性
            if(typeof obj[key] ==='object' && obj[key]!==null){//判断类型
                newObj[key]=deepCopy(obj[key])
            }else{
                newObj[key]=obj[key]
            }
        }
    }
    return newObj
}
console.log(deepCopy(obj));
